<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
    <meta charset="utf-8"/>
    <title>    TFC-Trotri Foundation Classes &raquo; \tfc\auth\Authentica
</title>
    <meta name="author" content=""/>
    <meta name="description" content=""/>

            <link href="../css/template.css" rel="stylesheet" media="all"/>
    
            <!--[if lt IE 9]>
        
        <![endif]-->
        <script src="../js/jquery-1.7.1.min.js" type="text/javascript"></script>
        <script src="../js/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script>
        <script src="../js/jquery.mousewheel.min.js" type="text/javascript"></script>
        <script src="../js/bootstrap.js" type="text/javascript"></script>
        <script src="../js/template.js" type="text/javascript"></script>
        <script src="../js/prettify/prettify.min.js" type="text/javascript"></script>
    
            <link rel="shortcut icon" href="../img/favicon.ico"/>
        <link rel="apple-touch-icon" href="../img/apple-touch-icon.png"/>
        <link rel="apple-touch-icon" sizes="72x72" href="../img/apple-touch-icon-72x72.png"/>
        <link rel="apple-touch-icon" sizes="114x114" href="../img/apple-touch-icon-114x114.png"/>
    </head>
<body>

        <div class="navbar navbar-fixed-top">
        <div class="navbar-inner">
            <div class="container">
                <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                    <span class="icon-bar"></span> <span class="icon-bar"></span>
                    <span class="icon-bar"></span> </a>
                <a class="brand" href="http://www.trotri.com/">Trotri官网</a><a class="brand" href="../index.html">TFC-Trotri Foundation Classes</a>

                <div class="nav-collapse">
                    <ul class="nav">
                        <li class="dropdown">
                            <a href="#api" class="dropdown-toggle" data-toggle="dropdown">
                                API Documentation <b class="caret"></b>
                            </a>
                            <ul class="dropdown-menu">
                                                                    <li><a>Namespaces</a></li>
                                                                        <li><a href="../namespaces/tfc.html">tfc</a></li>
                                                                                                                                </ul>
                        </li>
                        <li class="dropdown" id="charts-menu">
                            <a href="#charts" class="dropdown-toggle" data-toggle="dropdown">
                                Charts <b class="caret"></b>
                            </a>
                            <ul class="dropdown-menu">
                                <li>
                                    <a href="../graph_class.html">
                                        <i class="icon-list-alt"></i>&#160;Class hierarchy diagram
                                    </a>
                                </li>
                            </ul>
                        </li>
                        <li class="dropdown" id="reports-menu">
                            <a href="#reports" class="dropdown-toggle" data-toggle="dropdown">
                                Reports <b class="caret"></b>
                            </a>
                            <ul class="dropdown-menu">
                                <li>
                                    <a href="../errors.html">
                                         
                                    </a>
                                </li>
                                <li>
                                    <a href="../markers.html">
                                        <i class="icon-list-alt"></i>&#160;Markers
                                    </a>
                                </li>
                                <li>
                                    <a href="../deprecated.html">
                                        <i class="icon-list-alt"></i>&#160;Deprecated
                                    </a>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="go_to_top">
            <a href="#___" style="color: inherit">Back to top&#160;&#160;<i class="icon-upload icon-white"></i></a>
        </div>
    </div>
    
    <div id="___" class="container">
        <noscript>
            <div class="alert alert-warning">
                Javascript is disabled; several features are only available if Javascript is enabled.
            </div>
        </noscript>

        
            <style>
        .deprecated h2 {
            text-decoration: line-through;
        }
    </style>
    <div class="row">
        <div class="span4">
                    <div class="btn-group view pull-right" data-toggle="buttons-radio">
        <button class="btn details" title="Show descriptions and method names"><i class="icon-list"></i></button>
        <button class="btn simple" title="Show only method names"><i class="icon-align-justify"></i></button>
    </div>
    <div class="btn-group visibility" data-toggle="buttons-checkbox">
        <button class="btn public active" title="Show public elements">Public</button>
        <button class="btn protected" title="Show protected elements">Protected</button>
        <button class="btn private" title="Show private elements">Private</button>
        <button class="btn inherited active" title="Show inherited elements">Inherited</button>
    </div>

        <ul class="side-nav nav nav-list">
        <li class="nav-header">
            <i class="icon-custom icon-method"></i> Methods
            <ul>
                                                                                                    <li class="method public">
        <a href="#method___construct" title="__construct :: 构造方法：初始化Cookie配置名">
            <span class="description">构造方法：初始化Cookie配置名</span><pre>__construct</pre>
        </a>
    </li>

                                                                                                        <li class="method public">
        <a href="#method_getIdentity" title="getIdentity :: 从Cookie中获取用户身份">
            <span class="description">从Cookie中获取用户身份</span><pre>getIdentity</pre>
        </a>
    </li>

                                                                                                        <li class="method public">
        <a href="#method_setIdentity" title="setIdentity :: 向Cookie中设置用户身份，所有参数中都不能包含&quot;\t&quot;字符">
            <span class="description">向Cookie中设置用户身份，所有参数中都不能包含&quot;\t&quot;字符</span><pre>setIdentity</pre>
        </a>
    </li>

                                                                                                        <li class="method public">
        <a href="#method_clearIdentity" title="clearIdentity :: 移除Cookie中的用户身份">
            <span class="description">移除Cookie中的用户身份</span><pre>clearIdentity</pre>
        </a>
    </li>

                                                                                                        <li class="method public">
        <a href="#method_hasIdentity" title="hasIdentity :: Cookie中是否存在用户身份">
            <span class="description">Cookie中是否存在用户身份</span><pre>hasIdentity</pre>
        </a>
    </li>

                                                                                                        <li class="method public">
        <a href="#method_getCookie" title="getCookie :: 获取Cookie管理类">
            <span class="description">获取Cookie管理类</span><pre>getCookie</pre>
        </a>
    </li>

                                                                                                        <li class="method public">
        <a href="#method_getCookieName" title="getCookieName :: 获取Cookie名">
            <span class="description">获取Cookie名</span><pre>getCookieName</pre>
        </a>
    </li>

                                                                                                        <li class="method public">
        <a href="#method_getClusterName" title="getClusterName :: 获取Cookie配置名">
            <span class="description">获取Cookie配置名</span><pre>getClusterName</pre>
        </a>
    </li>

                                                </ul>
        </li>
        <li class="nav-header protected">» Protected
            <ul>
                                                                                                                                                                                                                                                                                                                                            </ul>
        </li>
        <li class="nav-header private">» Private
            <ul>
                                                                                                                                                                                                                                                                                                                                            </ul>
        </li>
        <li class="nav-header">
            <i class="icon-custom icon-constant"></i> Constants
            <ul>
                            </ul>
        </li>
    </ul>


        </div>

        <div class="span8">
            <div class="element class">
                <h1>Authentica</h1>
                <small style="display: block; text-align: right">
                                                        </small>
                <p class="short_description">Authentica class file
用户身份认证类</p>
                <div class="details">
                    <div class="long_description">
                        <p>配置 /cfg/app/appname/main.php：</p>
<pre>
return array (
  'account' => array (
    'key_name' => 'auth_administrator',      // 密钥配置名
    'domain' => '',                          // Cookie的有效域名，缺省：当前域名
    'path' => '/',                           // Cookie的有效服务器路径，缺省：/
    'secure' => false,                       // FALSE：HTTP和HTTPS协议都可传输；TRUE：只通过加密的HTTPS协议传输，缺省：FALSE
    'httponly' => true,                      // TRUE：只能通过HTTP协议访问；FALSE：HTTP协议和脚本语言都可访问，容易造成XSS攻击，缺省：TRUE
    'expiry' => WEEK_IN_SECONDS,             // 记住密码时间
    'cookie_name' => 'atrid',                // Cookie名
    'cookset_password' => false,             // Cookie中设置密码，该配置不用于此类
    'cookset_rolenames' => true,             // Cookie中设置用户拥有的角色名，该配置不用于此类
    'cookset_appnames' => true,              // Cookie中设置用户拥有权限的项目名，该配置不用于此类
  ),
)
</pre>
<p>配置 /cfg/key/cluster.php：</p>
<pre>
return array (
  'auth_passport' => array (
    'crypt' => 'UViRN53uj7yZ5IAfdIGiq5bvRuCH9njd', // 加密密钥
    'sign' => 'xwFVMiM98nzW6PwW9jxCmT2mLTv5IJES',  // 签名密钥
    'expiry' => MONTH_IN_SECONDS,                  // 缺省的密文有效期，如果等于0，表示永久有效，单位：秒
    'rnd_len' => 20                                // 随机密钥长度，取值 0-32
  ),
)
</pre>
                    </div>
                    <table class="table table-bordered">
                                                                                    <tr>
                                    <th>
                                        author
                                                                            </th>
                                    <td>
                                                                                    
                                                                                <p>宋欢 <a href="mailto:trotri@yeah.net">trotri@yeah.net</a></p>
                                    </td>
                                </tr>
                                                                                                                <tr>
                                    <th>
                                        version
                                                                            </th>
                                    <td>
                                                                                    
                                                                                <p>$Id: Authentica.php 1 2014-04-20 01:08:06Z huan.song $</p>
                                    </td>
                                </tr>
                                                                                                                <tr>
                                    <th>
                                        package
                                                                            </th>
                                    <td>
                                                                                    
                                                                                <p>tfc.auth</p>
                                    </td>
                                </tr>
                                                                                                                <tr>
                                    <th>
                                        since
                                                                            </th>
                                    <td>
                                                                                    1.0
                                                                                
                                    </td>
                                </tr>
                                                                                                                                                                                                                                    </table>

                    <h3><i class="icon-custom icon-method"></i> Methods</h3>
                                                                <a id="method___construct"></a>
                        <div class="element clickable method public  method___construct" data-toggle="collapse" data-target=".method___construct .collapse">
                            <h2>构造方法：初始化Cookie配置名</h2>
                            <pre>__construct(string $clusterName) </pre>
                            <div class="labels">
                                                                                                                                                                                            </div>
                            <div class="row collapse">
                                <div class="detail-description">
                                    <div class="long_description"></div>

                                    <table class="table">
                                                                                    <tr>
                                                <th>
                                                    throws
                                                </th>
                                                <td>
                                                                                                                                                                        
                                                                                                                                                                        <p>如果Cookie配置名为空，抛出异常</p>
                                                                                                    </td>
                                            </tr>
                                                                                    <tr>
                                                <th>
                                                    
                                                </th>
                                                <td>
                                                                                                    </td>
                                            </tr>
                                                                                    <tr>
                                                <th>
                                                    
                                                </th>
                                                <td>
                                                                                                    </td>
                                            </tr>
                                                                            </table>

                                                                            <h3>Arguments</h3>
                                                                                    <div class="subelement argument">
                                                <h4>$clusterName</h4>
                                                <code>string</code><p></p>
                                            </div>
                                                                            
                                                                    </div>
                            </div>
                        </div>
                                            <a id="method_getIdentity"></a>
                        <div class="element clickable method public  method_getIdentity" data-toggle="collapse" data-target=".method_getIdentity .collapse">
                            <h2>从Cookie中获取用户身份</h2>
                            <pre>getIdentity() : array</pre>
                            <div class="labels">
                                                                                                                                                                                            </div>
                            <div class="row collapse">
                                <div class="detail-description">
                                    <div class="long_description"></div>

                                    <table class="table">
                                                                                    <tr>
                                                <th>
                                                    
                                                </th>
                                                <td>
                                                                                                    </td>
                                            </tr>
                                                                                    <tr>
                                                <th>
                                                    
                                                </th>
                                                <td>
                                                                                                    </td>
                                            </tr>
                                                                            </table>

                                    
                                                                            <h3>Response</h3>
                                        <code>array</code><p></p>
                                                                    </div>
                            </div>
                        </div>
                                            <a id="method_setIdentity"></a>
                        <div class="element clickable method public  method_setIdentity" data-toggle="collapse" data-target=".method_setIdentity .collapse">
                            <h2>向Cookie中设置用户身份，所有参数中都不能包含&quot;\t&quot;字符</h2>
                            <pre>setIdentity(integer $userId, string $userName, string $password, integer $expiry, string $nickname = &#039;&#039;, array $roleNames = array(), string $extends = &#039;&#039;) : boolean</pre>
                            <div class="labels">
                                                                                                                                                                                            </div>
                            <div class="row collapse">
                                <div class="detail-description">
                                    <div class="long_description"></div>

                                    <table class="table">
                                                                                    <tr>
                                                <th>
                                                    throws
                                                </th>
                                                <td>
                                                                                                                                                                        
                                                                                                                                                                        <p>如果用户ID错误，抛出异常</p>
                                                                                                                                                                        
                                                                                                                                                                        <p>如果用户名为空，抛出异常</p>
                                                                                                                                                                        
                                                                                                                                                                        <p>如果有效期错误，抛出异常</p>
                                                                                                    </td>
                                            </tr>
                                                                                    <tr>
                                                <th>
                                                    
                                                </th>
                                                <td>
                                                                                                    </td>
                                            </tr>
                                                                            </table>

                                                                            <h3>Arguments</h3>
                                                                                    <div class="subelement argument">
                                                <h4>$userId</h4>
                                                <code>integer</code><p></p>
                                            </div>
                                                                                    <div class="subelement argument">
                                                <h4>$userName</h4>
                                                <code>string</code><p></p>
                                            </div>
                                                                                    <div class="subelement argument">
                                                <h4>$password</h4>
                                                <code>string</code><p></p>
                                            </div>
                                                                                    <div class="subelement argument">
                                                <h4>$expiry</h4>
                                                <code>integer</code><p></p>
                                            </div>
                                                                                    <div class="subelement argument">
                                                <h4>$nickname</h4>
                                                <code>string</code><p></p>
                                            </div>
                                                                                    <div class="subelement argument">
                                                <h4>$roleNames</h4>
                                                <code>array</code><p></p>
                                            </div>
                                                                                    <div class="subelement argument">
                                                <h4>$extends</h4>
                                                <code>string</code><p></p>
                                            </div>
                                                                            
                                                                            <h3>Response</h3>
                                        <code>boolean</code><p></p>
                                                                    </div>
                            </div>
                        </div>
                                            <a id="method_clearIdentity"></a>
                        <div class="element clickable method public  method_clearIdentity" data-toggle="collapse" data-target=".method_clearIdentity .collapse">
                            <h2>移除Cookie中的用户身份</h2>
                            <pre>clearIdentity() : boolean</pre>
                            <div class="labels">
                                                                                                                                                                                            </div>
                            <div class="row collapse">
                                <div class="detail-description">
                                    <div class="long_description"></div>

                                    <table class="table">
                                                                                    <tr>
                                                <th>
                                                    
                                                </th>
                                                <td>
                                                                                                    </td>
                                            </tr>
                                                                                    <tr>
                                                <th>
                                                    
                                                </th>
                                                <td>
                                                                                                    </td>
                                            </tr>
                                                                            </table>

                                    
                                                                            <h3>Response</h3>
                                        <code>boolean</code><p></p>
                                                                    </div>
                            </div>
                        </div>
                                            <a id="method_hasIdentity"></a>
                        <div class="element clickable method public  method_hasIdentity" data-toggle="collapse" data-target=".method_hasIdentity .collapse">
                            <h2>Cookie中是否存在用户身份</h2>
                            <pre>hasIdentity() : boolean</pre>
                            <div class="labels">
                                                                                                                                                                                            </div>
                            <div class="row collapse">
                                <div class="detail-description">
                                    <div class="long_description"></div>

                                    <table class="table">
                                                                                    <tr>
                                                <th>
                                                    
                                                </th>
                                                <td>
                                                                                                    </td>
                                            </tr>
                                                                                    <tr>
                                                <th>
                                                    
                                                </th>
                                                <td>
                                                                                                    </td>
                                            </tr>
                                                                            </table>

                                    
                                                                            <h3>Response</h3>
                                        <code>boolean</code><p></p>
                                                                    </div>
                            </div>
                        </div>
                                            <a id="method_getCookie"></a>
                        <div class="element clickable method public  method_getCookie" data-toggle="collapse" data-target=".method_getCookie .collapse">
                            <h2>获取Cookie管理类</h2>
                            <pre>getCookie() : \tfc\saf\Cookie</pre>
                            <div class="labels">
                                                                                                                                                                                            </div>
                            <div class="row collapse">
                                <div class="detail-description">
                                    <div class="long_description"></div>

                                    <table class="table">
                                                                                    <tr>
                                                <th>
                                                    
                                                </th>
                                                <td>
                                                                                                    </td>
                                            </tr>
                                                                                    <tr>
                                                <th>
                                                    
                                                </th>
                                                <td>
                                                                                                    </td>
                                            </tr>
                                                                            </table>

                                    
                                                                            <h3>Response</h3>
                                        <code><a href="../classes/tfc.saf.Cookie.html">\tfc\saf\Cookie</a></code><p></p>
                                                                    </div>
                            </div>
                        </div>
                                            <a id="method_getCookieName"></a>
                        <div class="element clickable method public  method_getCookieName" data-toggle="collapse" data-target=".method_getCookieName .collapse">
                            <h2>获取Cookie名</h2>
                            <pre>getCookieName() : string</pre>
                            <div class="labels">
                                                                                                                                                                                            </div>
                            <div class="row collapse">
                                <div class="detail-description">
                                    <div class="long_description"></div>

                                    <table class="table">
                                                                                    <tr>
                                                <th>
                                                    
                                                </th>
                                                <td>
                                                                                                    </td>
                                            </tr>
                                                                                    <tr>
                                                <th>
                                                    
                                                </th>
                                                <td>
                                                                                                    </td>
                                            </tr>
                                                                            </table>

                                    
                                                                            <h3>Response</h3>
                                        <code>string</code><p></p>
                                                                    </div>
                            </div>
                        </div>
                                            <a id="method_getClusterName"></a>
                        <div class="element clickable method public  method_getClusterName" data-toggle="collapse" data-target=".method_getClusterName .collapse">
                            <h2>获取Cookie配置名</h2>
                            <pre>getClusterName() : string</pre>
                            <div class="labels">
                                                                                                                                                                                            </div>
                            <div class="row collapse">
                                <div class="detail-description">
                                    <div class="long_description"></div>

                                    <table class="table">
                                                                                    <tr>
                                                <th>
                                                    
                                                </th>
                                                <td>
                                                                                                    </td>
                                            </tr>
                                                                                    <tr>
                                                <th>
                                                    
                                                </th>
                                                <td>
                                                                                                    </td>
                                            </tr>
                                                                            </table>

                                    
                                                                            <h3>Response</h3>
                                        <code>string</code><p></p>
                                                                    </div>
                            </div>
                        </div>
                    
                    
                                                                <h3><i class="icon-custom icon-property"></i> Properties</h3>
                                                    <a id="property__clusterName"> </a>
                            <div class="element clickable property  protected property__clusterName" data-toggle="collapse" data-target=".property__clusterName .collapse">
                                <h2>Cookie配置名</h2>
                                <pre>_clusterName : string</pre>
                                <div class="labels">
                                                                                                        </div>
                                <div class="row collapse">
                                    <div class="detail-description">
                                        <div class="long_description"></div>

                                        <table class="table">
                                                                                            <tr>
                                                    <th>
                                                        var
                                                    </th>
                                                    <td>
                                                                                                                    <p>Cookie配置名</p>
                                                                                                            </td>
                                                </tr>
                                                                                            <tr>
                                                    <th>
                                                        
                                                    </th>
                                                    <td>
                                                                                                            </td>
                                                </tr>
                                                                                    </table>

                                                                                    <h3>Type(s)</h3>
                                            <code>string</code>
                                                                            </div>
                                </div>
                            </div>
                                                    <a id="property__identity"> </a>
                            <div class="element clickable property  protected property__identity" data-toggle="collapse" data-target=".property__identity .collapse">
                                <h2>寄存用户身份信息</h2>
                                <pre>_identity : array</pre>
                                <div class="labels">
                                                                                                        </div>
                                <div class="row collapse">
                                    <div class="detail-description">
                                        <div class="long_description"></div>

                                        <table class="table">
                                                                                            <tr>
                                                    <th>
                                                        var
                                                    </th>
                                                    <td>
                                                                                                                    <p>寄存用户身份信息</p>
                                                                                                            </td>
                                                </tr>
                                                                                            <tr>
                                                    <th>
                                                        
                                                    </th>
                                                    <td>
                                                                                                            </td>
                                                </tr>
                                                                                    </table>

                                                                                    <h3>Type(s)</h3>
                                            <code>array</code>
                                                                            </div>
                                </div>
                            </div>
                                                            </div>
            </div>
            <a id="\tfc\auth\Authentica"></a>
            <ul class="breadcrumb">
                <li><a href="../index.html"><i class="icon-custom icon-class"></i></a></li>
                    
    
    <li><span class="divider">\</span><a href="../namespaces/tfc.auth.html">auth</a></li>

                <li class="active"><span class="divider">\</span><a href="../classes/tfc.auth.Authentica.html">Authentica</a></li>
            </ul>
        </div>
    </div>

    </div>

        <footer class="span12">
            Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by
            <a href="http://glyphicons.com/">Glyphicons</a>.<br/>
            Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and<br/>
            generated on Sat, 27 Dec 2014 06:16:39 +0000.<br/>
    </footer>
    </body>
</html>
